package com.chuang.bootplus.controller;


import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.entity.Message;
import com.chuang.bootplus.po.MessagePO;
import com.chuang.bootplus.po.UUserPO;
import com.chuang.bootplus.service.MessageService;
import com.chuang.bootplus.vo.MessageVO;
import com.chuang.bootplus.vo.UserInfoVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-11-22
 */
@RestController
@RequestMapping("/message")
@Api(tags = {"用户信息"})
@CrossOrigin
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MessageController {


    @Autowired
    MessageService messageService;

    @PostMapping("send")
    @ApiOperation(httpMethod = "POST" ,value = "存储留言")
    public  ApiResponse<Void> send(@RequestBody MessagePO po){
        return  messageService.send(po);
    }


    @PostMapping("listAll")
    @ApiOperation(httpMethod = "POST" ,value = "展示留言")
    public  ApiResponse<MessageVO> listAll(){
        return  messageService.listAll();
    }
}

